<template>
<view>
  <view class="box">
    <view>
      checkbox1:{{checkbox1}}
    </view>
    <checkbox-group @change="change1">
      <label @click="clickCheckbox1(0)">
        <checkbox value="0"/>不同意
      </label>
      <label  @click="clickCheckbox1(1)">
        <checkbox value="1"/>同意
      </label>
    </checkbox-group>
  </view>
</view>
</template>

<script>
export default {
  data(){
    return {
      checkbox1:[]
    }
  },
  methods:{
    change1(e){
      console.log(e.target.value, e.detail.value);
    },
    clickCheckbox1(v){
      if(this.checkbox1.includes(v)){
        const index = this.checkbox1.findIndex(v1=>v1===v);
        this.checkbox1.splice(index,1);
      }else{
        this.checkbox1.push(v);
      }
    }
  }
}
</script>

<style scoped>
.box{
  margin:8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #320e0e;
}
</style>
